<template>
	<view class="pages">
    <up-tabs
			activeStyle="#2E90EC"
			:scrollable="false"
			lineWidth="40rpx"
			:list="tabs"
			@click="onSkipTabs"
		></up-tabs>
		<view v-show="active === 'base'">
      <view class="pages-details">
        <view class="pages-details-cotent">
          <view class="pages-list-item" style="background-color: #fff;"> 
            <view class="pages-item-row">
              <text class="pages-hint-title">提交人</text>
              <text class="pages-hint-content">王爱军</text>
            </view>
            <view class="pages-item-row">
              <text class="pages-hint-title">提交时间</text>
              <text class="pages-hint-content">2012-223-56</text>
            </view>
          </view>
        </view>
      </view>
      <view class="pages-statistics">
        <view class="pages-bolck-title">
          <text class="pages-bolck-title-ad"></text>
          巡查情况
        </view>
        <view>
          <view class="record ">
            <view class="record_lists pages-item" v-for="(item, index) in 6" :key="index">
              <view class="flex justify-between">
                <text>禁止违规住人</text>
                <view class="flex">
                  <up-icon class="margin-r-20" size="28" space="30" name="checkmark-circle-fill" color="#00c500"></up-icon>
                  <up-icon size="28" name="close-circle-fill" color="#00c500"></up-icon>
                </view>
              </view>
            </view>
          </view>
          <view class="u-demo-block">
            <text class="u-demo-block__title">巡查图片</text>
            <view class="u-demo-block__content">
              <u-upload
                :fileList="fileList1"
                @afterRead="afterRead"
                @delete="deletePic"
                name="1"
                multiple
                :maxCount="5"
              ></u-upload>
            </view>
          </view>

          <view class="u-demo-block">
            <text class="u-demo-block__title">整改期限</text>
            <view>2024-5-8</view>
          </view>

          <view class="u-demo-block">
            <text class="u-demo-block__title">巡查说明</text>
            <view class="u-demo-block__content">
              巡查说明巡查说明巡查说明巡查说明
            </view>
          </view>
        </view>
      </view>
    </view>

    <view v-show="active === 'log'">
      <view class="pages-details">
        <view class="pages-details-cotent">
          <view class="pages-list-item" style="background-color: #fff;"> 
            <view class="pages-item-row">
              <text class="pages-hint-title">提交人</text>
              <text class="pages-hint-content">王爱军</text>
            </view>
            <view class="pages-item-row">
              <text class="pages-hint-title">提交时间</text>
              <text class="pages-hint-content">2012-223-56</text>
            </view>
          </view>
        </view>
      </view>
      <view class="pages-statistics">
        <view class="pages-bolck-title">
          <text class="pages-bolck-title-ad"></text>
          巡查情况
        </view>
        <view>
          <view class="record ">
            <view class="record_lists pages-item" v-for="(item, index) in 6" :key="index">
              <view class="flex justify-between">
                <text>禁止违规住人</text>
                <view class="flex">
                  <up-icon class="margin-r-20" size="28" space="30" name="checkmark-circle-fill" color="#00c500"></up-icon>
                  <up-icon size="28" name="close-circle-fill" color="#00c500"></up-icon>
                </view>
              </view>
            </view>
          </view>
          <view class="u-demo-block">
            <text class="u-demo-block__title">巡查图片</text>
            <view class="u-demo-block__content">
              <u-upload
                :fileList="fileList1"
                @afterRead="afterRead"
                @delete="deletePic"
                name="1"
                multiple
                :maxCount="5"
              ></u-upload>
            </view>
          </view>

          <view class="u-demo-block">
            <text class="u-demo-block__title">整改期限</text>
            <view>2024-5-8</view>
          </view>

          <view class="u-demo-block">
            <text class="u-demo-block__title">巡查说明</text>
            <view class="u-demo-block__content">
              巡查说明巡查说明巡查说明巡查说明
            </view>
          </view>
        </view>
      </view>
    </view>

    <view v-show="active === 'speed'">
      <view class="pages-details">
        <up-steps class="up-steps" current="1" direction="column" dot>
          <up-steps-item title="创建任务" iconSize="110" desc="2024-2-5" style="font-size:300px;">
          </up-steps-item>
          <up-steps-item title="分拨任务" iconSize="110" desc="2024-2-5">
          </up-steps-item>
          <up-steps-item title="任务退回" iconSize="110" desc="2024-2-5">
          </up-steps-item>
          <up-steps-item title="分拨任务" iconSize="110" desc="2024-2-5">
          </up-steps-item>
          <up-steps-item title="任务完成" iconSize="110" desc="2024-2-5">
          </up-steps-item>
        </up-steps>
      </view>
    </view>
		
		<view class="pages-buttons--fill"></view>
		<view class="pages-button">
			<view style="width:45%">
        <up-button 
          color="#2E90EC" 
          text="任务分拨"
          @click="onSkipRouterToAllocate"
        ></up-button>
      </view>
      <view style="width:45%">
        <up-button 
          color="#2E90EC" 
          text="返回"
        ></up-button>
      </view>
      <view style="width:45%">
        <up-button 
          color="#2E90EC" 
          text="整改"
          @click="onSkipRouterToAllocate"
        ></up-button>
      </view>
		</view>
	</view>
</template>

<script setup>
import { onLoad, onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app";
import { reactive, ref } from "vue";
import { onHasUserinfoData, onSetUserinfoData, onGetUserinfoData, onGetRoleIdData,  onSetRoleIdData, onSetRolesData, onGetRolesData } from "/common/userinfo.js"
import { onGetTaskDetails } from "/serves/api.js";

const tabs = ref([
	{ name: '巡查记录', value: 'base' },
	{ name: '整改记录', value: 'log' },
	{ name: '任务进度', value: 'speed' },
])


const loading = ref(true)
const details = ref({})


const onSkipRouterToAllocate  = () => {
	const url = '/pages/allocate/index'
	uni.navigateTo({ url })
}

const onPageGetTaskDetails = async (options) => {
	const { id } = options
	loading.value = true
	
	try{
		const response = await onGetTaskDetails(id)
		const { data } = response
		const { task } = data
		details.value = task
	} finally {
		loading.value = false
	}
}

const deletePic = (event) => {

};
const afterRead = async (event) => {

}

const onCallPerson = function () {
	uni.makePhoneCall({
		phoneNumber: '18664306776',
		success: () => {},
		fail: () => {}
	})
}

const scrolltolower  = function(e) {}

// 切换tabs
const active = ref('base')

const onSkipTabs = function (e) {
	active.value = e.value
	console.log(e)
}

const onSelectOrg = function () {
	selectOrgRef.value.onShowPopup()
}

const onSkipRouterToTaskItem = function () {
	const url = '/pages/task/item'
	uni.navigateTo({ url })
	// uni.navigateBack()
}

// onLoad((options) => onPageGetTaskDetails(options))
</script>

<style scoped lang="scss">
.up-steps{
  .u-steps .u-steps--column .up-steps{
    font-size: 136rpx!important;
  }
  :deep(.u-text__value){
    font-size: 136rpx;
  }
}
.record {
  .record_lists {
    padding: 20rpx 20rpx;
    margin-bottom: 20rpx;
    background: #fafbfe;
  }
}
.u-demo-block {
  flex: 1;
  margin-bottom: 23px;
  .u-demo-block__title {
    font-size: 14px;
    color: #8f9ca2;
    margin-bottom: 8px;
    display: flex;
    flex-direction: row;
  }
}
.pages{
  background: #fff;
}
.pages-details {
	width: 100%;
	height: auto;
	box-sizing: border-box;
	padding: 30rpx;
	padding-bottom: 0;
	// background-image: linear-gradient(180deg, #2E90EC 0%, #F2F2F2 90%);
}

.pages-details-cotent {
	width: 100%;
	height: auto;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: space-between;
	
}

.pages-list-item {
	width: 100%;
	height: auto;
	box-shadow: 8rpx 8rpx 16rpx 0px rgba(0,0,0,0.3);
	border-radius: 4rpx;
	box-sizing: border-box;
	padding: 24rpx 30rpx;
	margin-bottom: 30rpx;
	position: relative;
	overflow: hidden;
	transform: all 0.2s;
}

.pages-item-status {
	width: 150rpx;
	height: 150rpx;
	background-color: #317FFC;
	text-align: center;
	font-size: 24rpx;
	color: #FFFFFF;
	box-sizing: border-box;
	padding-top: 110rpx;
	transform: rotate(45deg);
	position: absolute;
	top: -75rpx;
	right: -75rpx;
	box-shadow: 4rpx 4rpx 4rpx 0px rgba(49, 127, 252, .3);
	
	&--warning {
		background-color: #FF9900;
		box-shadow: 4rpx 4rpx 8rpx 0px rgba(255, 153, 0, .3);
	}
	
	&--success {
		background-color: #00C500;
		box-shadow: 4rpx 4rpx 8rpx 0px rgba(0, 197, 0, .3);
	}
}

.pages-item-title {
	font-family: PingFangSC, PingFang SC;
	font-weight: 500;
	font-size: 36rpx;
	color: #171717;
	line-height: 1.5em;
	font-style: normal;
	width: 100%; 
	
	&--tag {
		padding: 5rpx 10rpx;
		font-size: 28rpx;
		color: #FF0000;
		border: 1px solid #FF0000;
		background-color: rgba(255, 0, 0, .1);
		margin-left: 20rpx;
		border-radius: 4rpx;
	}
	
	
}

.pages-item-row {
	width: 100%;
	min-height: 60rpx;
	height: auto;
	box-sizing: border-box;
	padding-top: 10rpx;
	display: flex;
	align-items: flex-start;
}

.pages-hint-title {
	width: 160rpx;
	font-weight: 400;
	font-size: 28rpx;
	color: #666666;
}

.pages-hint-content {
	display: inline-block;
	width: calc(100% - 160rpx);
	font-weight: 500;
	font-size: 28rpx;
	color: #333333;
	transition: all .3s;
	
	&--active {
		padding-top: 5rpx;
		
		&:active {
			opacity: 0.9;
		}
	}
}

.pages-hint-content--flex {
	display: inline-flex;
	align-items: center;
}

.pages-hint-content--hint {
	margin-left: 10rpx;
	font-weight: 400;
	font-size: 28rpx;
	color: #666666;
}

.pages-item-bolck {
	width: 100%;
	height: auto;
}

.pages-bolck-title {
	height: 70rpx;
	display: flex;
	align-items: center;
	font-weight: 500;
	font-size: 30rpx;
	color: #000000;
	box-sizing: border-box;
}

.pages-bolck-title-ad {
	width: 6rpx;
	height: 32rpx;
	background-color: #317FFC;
	border-radius: 3rpx;
	margin-right: 15rpx;
}

.pages-bolck-content {
	width: 100%;
	font-weight: 500;
	font-size: 28rpx;
	color: #333333;
	text-indent: 2em;
	line-height: 1.5em;
}

.pages-statistics {
	width: 100%;
	height: auto;
	box-sizing: border-box;
	padding: 10rpx 30rpx;
	padding-bottom: env(safe-area-inset-bottom);
}

.pages-item  {
	width: 100%;
	height: auto;
	background: linear-gradient(0deg, #FFFFFF 0%, #F6F9FF 100%);
	box-shadow: 8rpx 8rpx 16rpx 0px rgba(0,0,0,0.1);
	border-radius: 4rpx;
	box-sizing: border-box;
	padding: 32rpx;
	margin-bottom: 30rpx;
	transform: all 0.2s;
	
	&:active {
		background: linear-gradient(0deg, #FFFFFF 2%, rgba(126, 187, 255, .2) 100%);
		box-shadow: 8rpx 8rpx 16rpx 0px rgba(0,0,0,0.3);
	}
}

.pages-item-title {
	font-family: PingFangSC, PingFang SC;
	font-weight: 500;
	font-size: 32rpx;
	color: #333333;
	text-shadow: 0px 0px 10rpx rgba(109,114,141,0.17);
	text-align: justify;
	font-style: normal;
}

.pages-item-content {
	width: 100%;
	height: auto;
	box-sizing: border-box;
	padding: 20rpx 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
}


.pages-content-item {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	border-right: 1px solid #F6F6F6;
	
	&:last-child {
		border-right: 0;
	}
}

.pages-content-item-font {
	font-weight: 500;
	font-size: 48rpx;
	color: #317FFC;
	line-height: 1.5em;
	text-shadow: 0px 0px 10rpx rgba(109,114,141,0.17);
	text-align: left;
	font-style: normal;
	
	&--warning {
		color: #FF9900;
	}
	
	&--error {
		color: #FF0000;
	}
	
	&--success {
		color: #00C500;
	}
}

.pages-content-item-text {
	font-family: PingFangSC, PingFang SC;
	font-weight: 400;
	font-size: 28rpx;
	color: #999999;
	line-height: 1.5em;
	text-shadow: 0px 0px 10rpx rgba(109,114,141,0.17);
	text-align: left;
	font-style: normal;
}

.pages-buttons--fill {
	width: 100%;
	height: calc(110rpx + env(safe-area-inset-bottom));
}

.pages-button {
	width: 100%;
	height: calc(110rpx + env(safe-area-inset-bottom));
	box-sizing: border-box;
	padding: 30rpx;
	box-shadow: 0px 2px 8px 0px rgba(0,0,0,0.18);
	position: fixed;
	bottom: 0;
	left: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	background-color: #ffffff;
}

</style>